/*
 * CloudStego school project
 * @author lauris kruusamae
 * @author triin uudam
 * @author uku loskit
 */
package main;

/**
 * Implementation of a pixel with red, green and blue values
 * Index is the position in the image file.
 *
 */
public class Pixel implements Comparable<Pixel> {

    private int index;
    private int red;
    private int green;
    private int blue;
    
    public Pixel(int index, int red, int green, int blue) {
        this.index = index;
        this.red = red;
        this.green = green;
        this.blue = blue;
    }
  
    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public int getRed() {
        return red;
    }

    public void setRed(int red) {
        this.red = red;
    }

    public int getGreen() {
        return green;
    }

    public void setGreen(int green) {
        this.green = green;
    }

    public int getBlue() {
        return blue;
    }

    public void setBlue(int blue) {
        this.blue = blue;
    }

    @Override
    public String toString() {
        return "Pixel [index=" + index + " red=" + red + " green=" + green + " blue=" + blue + "]";
    }

    @Override
    public int compareTo(Pixel another) {
        int anotherIndex = another.getIndex();
        int thisIndex = this.getIndex();
        if (anotherIndex < thisIndex) {
            return 1;
        } else if (anotherIndex > thisIndex) {
            return -1;
        } else {
            return 0;
        }
    }
}
